"""
练习:
1.求100000以内质数之和，并且计算这个求和过程的时间
2.将100000分成4份，创建4个进程，每个进程求其中一份的质数之和，统计4个进程执行完的时间
"""
from threading import main_thread
import time


def judge_prime(n):
    if n <= 1:
        return False

    for i in range(2,n):
        if n % i == 0:
            return False
    return True

# 将100000以内的质数进行求和
def sum():
    total = 0
    for i in range(100000):
        if judge_prime(i):
            total += i
    print("100000以内的质数之和为：",total)

if __name__ == '__main__':
    start = time.time()
    sum()
    use_time = time.time() - start
    print("花费时间：",use_time)